package com.booksystem.campuslibrarymanagementsystem.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.booksystem.campuslibrarymanagementsystem.entity.AccountTable;
import com.booksystem.campuslibrarymanagementsystem.entity.UserTable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserTableMapper extends BaseMapper<UserTable> {
    //根据ids查询单条信息
    @Select("select * from user_table where ids = #{ids}")
    UserTable queryByIds(int ids);

    //根据ids更新状态
    @Update("update user_table set state = #{state} where ids= #{ids}")
    boolean upDataState(String ids,String state);

    //获取最后一条数据的ids
    @Select("SELECT * FROM user_table ORDER BY ids DESC LIMIT 1")
    UserTable selectLastIds();

    //根据ids更新名称
    @Update("update user_table set name = #{name} where ids= #{ids}")
    boolean upDataName(String ids,String name);

    //动态查询（ids，状态，名字）
    List<UserTable> selectListUser(String ids, String state,String name);

}
